package com.ckr.mapper;

import com.ckr.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

/**
 * @author Shadowckr
 * @create 2021-12-05 1:42
 */
public class UserMapperImplementation extends SqlSessionDaoSupport implements UserMapper {
    public List<User> selectUser() {
        User user1 = new User(10, "芬格尔", "555555");
        User user2 = new User(11, "路鸣泽", "654321");
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);
        mapper.addUser(user1);
        mapper.addUser(user2);
        mapper.deleteUser(11);
        return mapper.selectUser();
    }

    public int addUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).addUser(user);
    }

    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
